To declare and allocate space for a Person-type object named 'ralph', we would write:
Person *ralph;
ralph = new(Person);
The first line defines a variable named ralph which may contain the address of a Person object, and the second line dynamically allocates space for a Person object and places its address in the variable ralph. Using machine addresses like this is very common in C, and is discussed later in this chapter.
A method is invoked by sending the appropriate MESSAGE to the object. (This is identical to "calling a procedure" in a procedural language, but we will use the OOP terminology since this leads to a more natural understanding of the program.) To set and print ralph's instance variables, we would send the messages: